<?php

// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2025 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
declare(strict_types=1);

namespace app\services;

use Closure;

use think\App;
use think\Request;
use think\Response;
use think\Session;
use think\Facade\Event;

/**
 * Session初始化
 */
class SwooleInit
{
    public function __construct(protected App $app, protected Session $session)
    {

//        echo "\033[32m"; // 绿色文本
//        printf("| %-10s |", "Success");
//        echo "\033[0m";  // 重置颜色
//        echo "swoole Init";
    }


    public function handle($event): void
    {


        $this->formatTxt("swoole Init");
        $this->formatTxt("");
        $context = "端口：" . 9527 ;
        $this->formatTxt($context);


    }

    /**
     * @param string $context
     * @return void
     */
    public function formatTxt(string $context): void
    {
        echo "\033[32m";
        printf(   date("Y-m-d H:i:s") . "| %-10s ", $context  );
        echo "\033[0m" . "\n";
    }

}
